"use strict";
let str = "defddfrt";
const uniq = (str) => {
    let arr = str.split("");
    let newArr = [];
    arr.forEach((item) => {
        if (newArr.indexOf(item) === -1) {
            newArr.push(item);
        }
    });
    return newArr.join("");
};
console.log(uniq(str));
let but = document.querySelector("#but");
but.onclick = function () {
    let code = Math.random().toString(36).slice(-4);
    let color = "#" + Math.random().toString().slice(-6);
    console.log(color);
    let size = Math.floor(Math.random() * 31 + 12) + "px";
    but.innerHTML = code;
    but.style.color = color;
    but.style.fontSize = size;
};
const more = (arr) => {
    let obj = {};
    for (let i = 0; i < arr.length; i++) {
        if (!obj[arr[i]]) {
            obj[arr[i]] = 1;
        }
        else {
            obj[arr[i]]++;
        }
    }
    let key = Object.keys(obj);
    let max = "", maxNum = 0;
    for (let i = 0; i < key.length; i++) {
        if (obj[key[i]] > maxNum) {
            maxNum = obj[key[i]];
            max = key[i];
        }
    }
    console.log(maxNum);
    return max;
};
console.log(more([1, 5, 1, 8]));
const unite = (a, b) => {
    let arr = new Set([...a, ...b]);
    return arr;
};
console.log(unite([1, 3, 2], [5, 2, 1, 4]));
const findLongerWord = (word) => {
    let arr = word.split(" ");
    let max = arr[0];
    for (let i = 0; i < arr.length; i++) {
        if (arr[i].length > max.length) {
            max = arr[i];
        }
    }
    return max;
};
console.log(findLongerWord("The quick brown fox jumped over the lazy dog"));
function maxValue(can) {
    let max = can[0];
    let arr = [];
    for (let i = 0; i < can.length; i++) {
        if (can[i] > max) {
            max = can[i];
        }
    }
    return arr;
}
console.log(maxValue([1, 9, 5, 3, 4, 1]));
